package com.lc.projects.design.pattern.chain;

/**
 * @author liangchao03
 * @date 2017/7/18
 */
public class ChainTest {
    public static void main(String[] args) {
        Calculator add = new AddCalc();
        Calculator sub = new SubCalc();
        Calculator multiply = new MultiplyCalc();
        Calculator divide = new DivideCalc();

        add.setNextCalculator(sub);
        sub.setNextCalculator(multiply);
        multiply.setNextCalculator(divide);

        int result = add.handle(2,5,"1");
        System.out.println(result);
    }
}
